import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
  testDir: './tests',
  fullyParallel: true,
  forbidOnly: !!process.env.CI,
  retries: 2,
  workers: process.env.CI ? 1 : undefined,
  reporter: [
    ['html', {}],
    ['list'],
    [
      'json',
      {
        outputFile: 'test-results/test-results.json',
      },
    ],
  ],
  timeout: 60 * 1000,
  use: {
    trace: 'on',
    ignoreHTTPSErrors: true,
    locale: 'zh-CN',
    launchOptions: {
      slowMo: 400,
    },
  },
  projects: [
    {
      name: 'chromium',
      use: {
        ...devices['Desktop Chromium'],
        viewport: {
          width: 1536,
          height: 816,
        },
      },
    },
  ],
});
